package com.lzj.demo.enums;

import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum GradeEnum {
    PRIMARY(1, "小学"),
    SECOND(2, "中学"),
    HIGH(3, "高中");
    private Integer code;
    private String desc;
    public String getDesc() {
        return desc;
    }
    public Integer getCode() {
        return code;
    }
    public static GradeEnum getEnumByCode(Integer code) {
        for (GradeEnum gradeEnum : GradeEnum.values()) {
            if (gradeEnum.getCode().equals(code)) {
                return gradeEnum;
            }
        }
        return null;
    }
}
